﻿package mortal.game.view.shopMall.shopQQ
{
    import Message.DB.Tables.*;
    import com.mui.controls.*;
    import com.mui.utils.*;
    import flash.events.*;
    import flash.text.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.item.*;
    import mortal.mvc.core.*;

    public class ShopQQZuandaRender extends GCellRenderer
    {
        private var _propName:GTextFiled;
        private var _shopItem:BaseItem;
        private var _buyBtn:GLoadingButton;
        private var _info:TTencentShop;
        private var _index:int;

        public function ShopQQZuandaRender()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.ShopQQItembg, 0, 3, this));
            var _loc_1:* = GlobalStyle.textFormatBai;
            _loc_1.align = TextFormatAlign.LEFT;
            _loc_1.size = 14;
            _loc_1.bold = true;
            this._propName = UIFactory.gTextField("", 64, 6, 120, 25, this, _loc_1, true);
            this._shopItem = UICompomentPool.getUICompoment(BaseItem);
            this._shopItem.x = 11;
            this._shopItem.y = 63;
            this._shopItem.setItemStyle(ItemStyleConst.Big, ImagesConst.ShopItemBg, 6, 6);
            this.addChild(this._shopItem);
            this._buyBtn = UIFactory.gLoadingButton(ResFileConst.RechargeShopBigBuy, 67, 148, 108, 44, this);
            this._buyBtn.configEventListener(MouseEvent.CLICK, this.clickHandler);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._shopItem.dispose(param1);
            this._buyBtn.dispose(param1);
            this._propName.dispose(param1);
            this._shopItem = null;
            this._buyBtn = null;
            this._propName = null;
            this._info = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function clickHandler(event:MouseEvent) : void
        {
            var _loc_2:* = new ShopQQData();
            _loc_2.amount = 1;
            _loc_2.desc = this._info.desc;
            _loc_2.price = this._info.originPrice;
            _loc_2.type = this._info.type;
            _loc_2.id = this._info.id;
            _loc_2.name = this._info.name;
            _loc_2.url = "zuanshiBig_" + (this._index + 1) + ".jpg";
            Dispatcher.dispatchEvent(new DataEvent(EventName.ShopBuyQQItem, _loc_2));
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._info = param1.info as TTencentShop;
            this._index = param1.index;
            this._propName.text = this._info.name;
            this._propName.x = (this.width - this._propName.textWidth) * 0.5;
            this._shopItem.source = "zuanshiBig_" + (this._index + 1) + ".jpg";
            this._shopItem.x = (this.width - this._shopItem.width) * 0.5;
            this._shopItem.toolTipData = this._info.name;
            this._buyBtn.x = (this.width - this._buyBtn.width) * 0.5;
            return;
        }// end function

    }
}
